def read2list(filename):
    file = open(filename, "r")
    data = file.readlines()
    return data
def SORTm (m):
    N = len(m)
    for I in range(N-1):
        for J in range(N-2, I-1, -1):
            if m[J+1]<m[J]:
                m[J], m[J+1]=m[J+1],m[J]
    return m
from time import *

m1 = read2list("m1_sorted.txt")
m2 = read2list("m2_reverse.txt")
m3 = read2list("m3_shuffle.txt")

M = [int(s)for s in m1]
t_start=time()
print(SORTm(M))
t_finish=time()
print("milliseconds program_8_1.py", round(t_finish - t_start) * 1000)

M = [int(s)for s in m2]
t_start=time()
print(SORTm(M))
t_finish=time()
print("milliseconds program_8_1.py", round(t_finish - t_start) * 1000)

M = [int(s)for s in m3]
t_start=time()
print(SORTm(M)) 
t_finish=time()
print("milliseconds program_8_1.py12", round(t_finish - t_start) * 1000)
